////A. Sasha and the Beautiful Array
////https://codeforces.com/contest/1929/problem/A
//
//#include <iostream>
//#include <cstring>
//#include <algorithm>
//#include <vector>
//#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <map>
//#include <set>
//#include <queue>
//#include <stack>
//#include <deque>
//#include <functional>
//#include <climits>
//
//#define quickio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//#define endl "\n"
//
//using namespace std;
//typedef long long ll;
//
//const int N = 105;
//int a[N];
//
//int main()
//{
//	int minn = INT_MAX, maxx = INT_MIN;
//	int t;
//	cin >> t;
//	while (t--)
//	{
//		int n;
//		cin >> n;
//		minn = INT_MAX, maxx = INT_MIN;
//		for (int i = 0; i < n; i++)
//		{
//			cin >> a[i];
//			if (a[i] > maxx)
//				maxx = a[i];
//			if (a[i] < minn)
//				minn = a[i];
//		}
//
//		cout << maxx - minn << endl;
//	}
//	return 0;
//}